<?php echo $this->render('link/header.phtml') ?>
<?php $gridId=uniqid(); ?>
//常用变量初始化
var menuAddUrl=baseUrl+'/link/serverarticle/type/add';
var module="link.article.add";
var gridTitle="添加软文";

Ext.form.Field.prototype.msgTarget = 'side';
          
 
                                                                                
var link_add=new Ext.FormPanel({
	frame:true,
    title:gridTitle,
    labelWidth:80,
    //width:800,
    autoWidht:true,
    autoHeight:true,
    renderTo:'grid_<?=$gridId?>',
    bodyStyle:'padding:0 0 0 0;',    
    items:[
    		{
            xtype:'textfield',
            fieldLabel:'标题',
            width:600,
            name:'article_title',
            allowBlank:false
        	},{
            xtype:'htmleditor',
            width:600,
            height:400,
            name:'article_content',
            fieldLabel:'软文正文',
            allowBlank:false
            },{
            xtype:'textfield',
            name:'article_tags',
            fieldLabel:'Tags',
            width:600
            }   		  	
    ],
    buttons:[
    {
    id:'submit',
    text:'提交',
    type:'submit',
    iconCls:'icn-control',
    handler:function(){
    if(link_add.getForm().isValid()){
    link_add.getForm().submit({
    waitTitle:'提示',
    waitMsg:'请稍等',
    url:menuAddUrl,
    success:function(form,action){
    	var _message=Ext.util.JSON.decode(action.response.responseText);
		Ext.MessageBox.alert('提示',_message.msg,function(){
        Ext.getCmp('content').getActiveTab().getUpdater().refresh();
        });
    },
    failure:function(form,action){
    	var _message=Ext.util.JSON.decode(action.response.responseText);
        Ext.MessageBox.alert('提示',_message.msg);
    }
    });
    }   
    }},{
    text:'退出',
    handler:function(){
   	Ext.getCmp('content').remove(Ext.getCmp('content').getActiveTab());
    }
    }
    ]
});

});
</script>
<body style="width:98%;height:100%">
<div id='grid_<?=$gridId?>'></div>
</body>
</html>
